package net.iceflow.dunsel.example.client.model.dto;

import com.beust.jcommander.Parameter;

/**
 * Arguments DTO for command line parameters.
 */
public class Arguments {

    @Parameter(names = {"-h", "--host"}, description = "Server hostname/IP")
    private String _host;

    @Parameter(names = {"-p", "--port"}, description = "Server port")
    private int _port = 6771;

    @Parameter(names = {"-?", "--help"}, description = "This usage information")
    private boolean usageHelp = false;

    /**
     * Determines if the minimum required arguments were supplied.
     * @return Truth of validity
     */
    public boolean validate() {

        boolean isValid = true;

        if (this._host == null) {
            isValid = false;
        } else if ("".equals(this._host)) {
            isValid = false;
        }

        if (this._port < 1) {
            isValid = false;
        }

        return isValid;
    }

    /**
     * @return the host
     */
    public String getHost() {
        return _host;
    }

    /**
     * @param host the host to set
     */
    public void setHost(String host) {
        this._host = host;
    }

    /**
     * @return the _port
     */
    public int getPort() {
        return _port;
    }

    /**
     * @param port the _port to set
     */
    public void setPort(int port) {
        this._port = port;
    }

    /**
     * @return the usageHelp
     */
    public boolean isUsageHelp() {
        return usageHelp;
    }

    /**
     * @param usageHelp the usageHelp to set
     */
    public void setUsageHelp(boolean usageHelp) {
        this.usageHelp = usageHelp;
    }
}
